<Query Kind="VBStatements">
  <Connection>
    <ID>a50d59f2-50a7-4e3c-b893-7b7c3ce076e7</ID>
    <Server>WEBSQL</Server>
    <Database>abpc</Database>
    <ShowServer>true</ShowServer>
  </Connection>
</Query>

PrintHello() 	
	PrintAMessage("Second Message")
  
	Dim x = Add(1, 2)
	x.Dump("The function returns back a value")
	Add(2, 3).Dump("We don't need to put the results into a variable")
	Add(Add(1, 2), 3).Dump("Functions can be nested, and inner functions are called first")

	hypotenuse(3, 4).Dump("A perfect hypotenuse")

	' This function will essentially count for us
	For i = 1 to 8
		GetNextNumber().Dump()
	Next i

End Sub ' We need this for LINQPad if we want to declare subroutine like we are below.


' SUBROUTINES
' ********************************
' Sub routines are like sub-programs.  Unlike Functions, they never return back information

Sub PrintHello()
  PrintAMessage("First Message")
End Sub

' Sub-routines can have parameters, like this one which has the parameter "message"
Sub PrintAMessage(message As String)
  Console.WriteLine(message)
End Sub

' FUNCTIONS
' ********************************
' Functions are like sub-routines, but they return back information.

Function Add(x As Integer, y As Integer) As Integer
  return x + y
End Function

Function hypotenuse(ByVal side1 As Single, ByVal side2 As Single) As Single
	Return Math.Sqrt((side1 ^ 2) + (side2 ^ 2))
End Function


' This variable is being used by the next function.
' It's declared OUTSIDE the function because we want
' to remember it.  If it was declared INSIDE the function,
' it would always reset every time we call the function.
Dim NextNumber As Integer = 1

' This function will multiply the NextNumber variable by two
' and return it.  Every time you call the function,
' it will return a bigger number.
' FYI:  This is a bad design, but it proves a point.
Function GetNextNumber() As Integer
  NextNumber = NextNumber * 2
  return NextNumber
End Function




Sub Fake 
' Again, We need this for LINQPad if we want to declare subroutine like we are above.